﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using V_League.Public;

namespace V_League.DataAccess
{
    public class NTT_DataAccess
    {
        clsConnect cls;

        public DataTable ListNTT()
        {
            cls = new clsConnect();
            DataTable dt = cls.LoadData("listNTT");
            cls.Disconnect();
            return dt;
        }

        public NTT_Public GetInfoNTT(String Ma_NTT)
        {
            cls = new clsConnect();
            NTT_Public NTT = new NTT_Public();
            int nParameter = 1;

            String[] name = new String[nParameter];
            Object[] value = new Object[nParameter];

            name[0] = "@MaNTT";
            value[0] = Ma_NTT;

            SqlDataReader reader = cls.ExecuteDataReader("GetInfoNTT", name, value, nParameter);
            while (reader.Read())
            {
                NTT.Ma_NTT = Ma_NTT;
                NTT.Ten_NTT = reader["Ten_NTT"].ToString();
                NTT.DiaChi = reader["DChi"].ToString();
                NTT.QCao = reader["QCao"].ToString();
                NTT.HD = reader["HD"].ToString();
            }

            cls.Disconnect();
            return NTT;
        }
    }
}
